<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h4 class="modal-title" id="personModalLabel">更改个人信息</h4>
</div>
<div class="modal-body">
    <form id="person">
    <div class="form-group input-group  input-control">
        <span class="input-group-addon">用户名</span>
        <input type="text" class="form-control" placeholder="" disabled="disabled" value="<?php echo $uname; ?>">
    </div>
    <div class="form-group input-group  input-control">
        <span class="input-group-addon">&nbsp;&nbsp;姓名&nbsp;</span>
        <input type="text" class="form-control" placeholder="" name="nick" id="nick" value="<?php echo $nick; ?>">
    </div>
    <div class="form-group input-group  input-control">
        <span class="input-group-addon">&nbsp;&nbsp;手机&nbsp;</span>
        <input type="text" class="form-control" maxlength="11" placeholder="" name="phone" id="phone" value="<?php echo $phone; ?>">
    </div>
    <span class="span-phone" id="psphonecheck"></span>
    </form>
</div>
<div class="modal-footer">
    <span class="tips" id="pstip"></span>
    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
    <button type="button" class="btn btn-primary" id="personedit">确认</button>
</div>
<script>
$(document).ready(function() {
    $('#personedit').click(function() {
        var nick = $('#nick');
        var phone = $('#phone');
        if (!nick.val().trim()) {
            alert('请填写姓名');
            nick.focus();
            return;
        }

        if (!phone.val().trim()) {
            alert('请填写手机号');
            phone.focus();
            return;
        }
        if (!/^1\d{10}$/.test(phone.val().trim())) {
            alert('请填写正确的手机号');
            phone.focus();
            return;
        }
        $.ajax({
            cache: true,
            type: "POST",
            url:"<?php echo APP_ADMIN_PATH; ?>/user/modifyuserinfo",
            data:$('#person').serialize(),
            dataType: 'json',
            error: function(data) {
                alert('系统异常，请稍后再试！');
            },
            success: function(data) {
                alert(data.msg);
                if(data.retcode == 2000000) {
                    refresh();
                }
            }
        });
    });
});
</script>
